<?php
//Open the passwords.txt file for the class
//Scan for the student name.
//Password is located after the first comma. Grab and return.
function grab_pass($student,$class){
	$file="../data/Classes/" . $class . "/passwords.txt";
	$fr=fopen($file,'r');
	$found=1;
	$value="";
	while(!feof($fr) && $found == 1){
		$string=fgets($fr);
		$pos=stripos($string,",");
		$sub=substr($string,0,$pos);
		if(strcmp($student,$sub) == 0){
			$value=substr($string,$pos+1);
			$found=0;
		}
	}
	fclose($fr);
	return $value;
}
?>